package userInterface;

import java.awt.Color;
import java.util.ArrayList;

public abstract class DrawObject
{
	public DrawObject(Color color)
	{
		_color = color;
		_models = new ArrayList<DrawingModel>();
	}

	public Color getColor()
	{
		return _color;
	}
	
	public void setColor(Color color)
	{
		_color = color;
	}

	public void setColor(int red, int green, int blue)
	{
		// used to set the min and max of these colors
		if (red > 255)
			red = 255;
		if (red < 0)
			red = 0;
		if (green > 255)
			green = 255;
		if (green < 0)
			green = 0;
		if (blue > 255)
			blue = 255;
		if (blue < 0)
			blue = 0;
		
		_color = new Color(red, blue, blue);
		
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public Shape getShape() 
	{
		return _shape;
	}

	public void setShape(Shape shape)
	{
		_shape = shape;
	}
	
	public void addModelListener(DrawingModel model)
	{
		_models.add(model);
	}
	
	public abstract void move(int x, int y);
	
	private Color _color;

	private Shape _shape;
	
	protected ArrayList<DrawingModel> _models;
}
